/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication6.ControlLayer;


import javaapplication6.DomainLayer.CustomerRecords;
import javaapplication6.DomainLayer.Customer;
public class CustomerControl {

    private CustomerRecords customerRecords=CustomerRecords.getCustomerRecords();
    private long idOfCustomer=0;

    //
    public void createCustomer(String name, String phoneNo, String address, boolean businessC)
    {
        idOfCustomer=idOfCustomer+1;
        Customer customer=new Customer(name, phoneNo, address, businessC, idOfCustomer);
        customerRecords.addCustomer(customer);
    }


    //
    public void deleteCustomer(long id)
    {
        customerRecords.deleteCustomer(id);
    }

    //
    public Customer findCustomer(long id)
    {
        return customerRecords.customerByID(id);
    }

    //
    public void printCustomerInfo(long id)
    {
        try{
        customerRecords.customerByID(id).printCustomerInfo();
        }
        catch(Exception e){
            customerRecords.customerByID(id);
        }
    }

    public void printCustomerList()
    {
        customerRecords.printCustomerList();
    }

    public void setDiscount(boolean isBusiness,double discount)
    {
        customerRecords.setDiscount(isBusiness, discount);
    }

}
